import { createRouter,createWebHashHistory } from 'vue-router'

const routes = [
    { 
        path: '/', 
        redirect: '/index',
    },
    { 
        path: '/login', 
        component: () => import('../views/login.vue')
    },
    { 
        path: '/index', 
        redirect: '/index/button',
        component: () => import('../views/index.vue'),
        children:[
            { path: 'userList', component: () => import('../views/userList.vue') },
            { path: 'button', component: () => import('../views/ElementExample/ButtonPage.vue') },
            { path: 'form', component: () => import('../views/ElementExample/FormPage.vue') },
            { path: 'table', component: () => import('../views/ElementExample/TablePage.vue') }
        ]
    }
]

const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes, // `routes: routes` 的缩写
})

export default router
